package com.xiaoh.dormitoryrepairreportbackend.controller;

import com.xiaoh.dormitoryrepairreportbackend.common.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 健康检查接口
 */
@RestController
@RequestMapping("/health")
@Tag(name = "健康检查", description = "系统健康检查接口")
public class HealthController {

    /**
     * 健康检查
     */
    @GetMapping("/check")
    @Operation(summary = "健康检查", description = "检查系统是否正常运行")
    public BaseResponse<Map<String, Object>> healthCheck() {
        Map<String, Object> result = new HashMap<>();
        result.put("status", "UP");
        result.put("timestamp", LocalDateTime.now());
        result.put("service", "宿舍维修报修平台后端服务");
        result.put("version", "1.0.0");
        return BaseResponse.success(result);
    }
}
